/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.lmx.repoDomain.tmodel.business.User;//huibati
import javax.persistence.*;

/**
 * 通话表
 */
@Entity
@Table(name = "ccd_call")
@JsonApiResource(type = "call")
public class Call extends BaseEntity {
	private String code; // 通话编码
	private Short direction;// 类型:1呼入2呼出
	private String callingNumber;//呼入电话
	private String calledNumber;// 呼出电话
	private Integer beginTime;//开始时间
	private Integer endTime;// 结束时间
	private Integer duration;// 通话时长，单位:秒
	private Customer customer;// 对应客户
	private User agent;//对应客服
	private Dicttype status;//通话状态  对应字典:callStatus
	private Dicttype operation;//动作  对应字典 operationType
	private Task task; // 对应任务
	private Short failedCause;// 通话失败原因
	private String voiceRecording; //通话录音URL
	private Double cost;//当前通话通话费用
	private String sessionId;//华为：sessonId
	private String participatId;//华为：participatId

	private Integer createTime;//创建时间
	private Integer updateTime;//更新时间
	private String remark;//备注

	@Column(name = "code")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name="direction")
	public Short getDirection() {
		return direction;
	}

	public void setDirection(Short direction) {
		this.direction = direction;
	}

	@Column(name="calling_number")
	public String getCallingNumber() {
		return callingNumber;
	}

	public void setCallingNumber(String callingNumber) {
		this.callingNumber = callingNumber;
	}

	@Column(name="called_number")
	public String getCalledNumber() {
		return calledNumber;
	}

	public void setCalledNumber(String calledNumber) {
		this.calledNumber = calledNumber;
	}



	@Column(name="begin_time")
		public Integer getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(Integer beginTime) {
		this.beginTime = beginTime;
	}

	@Column(name="end_time")
	public Integer getEndTime() {
		return endTime;
	}

	public void setEndTime(Integer endTime) {
		this.endTime = endTime;
	}

	@Column(name="duration")
	public Integer getDuration() {
		return duration;
	}

	public void setDuration(Integer duration) {
		this.duration = duration;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "customer_id",foreignKey = @ForeignKey(name = "null"))
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "agent_id",foreignKey = @ForeignKey(name = "null"))
	public User getAgent() {
		return agent;
	}

	public void setAgent(User agent) {
		this.agent = agent;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "status_id",foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStatus() {
		return status;
	}

	public void setStatus(Dicttype status) {
		this.status = status;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "operation_id",foreignKey = @ForeignKey(name = "null"))
	public Dicttype getOperation() {
		return operation;
	}

	public void setOperation(Dicttype operation) {
		this.operation = operation;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "task_id",foreignKey = @ForeignKey(name = "null"))
	public Task getTask() {
		return task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	@Column(name = "failed_cause")
	public Short getFailedCause() {
		return failedCause;
	}

	public void setFailedCause(Short failedCause) {
		this.failedCause = failedCause;
	}

	@Column(name = "voice_recording")
	public String getVoiceRecording() {
		return voiceRecording;
	}

	public void setVoiceRecording(String voiceRecording) {
		this.voiceRecording = voiceRecording;
	}

	@Column(name = "cost")
	public Double getCost() {
		return cost;
	}

	public void setCost(Double cost) {
		this.cost = cost;
	}

	@Column(name = "session_id")
	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	@Column(name = "participat_id")
	public String getParticipatId() {
		return participatId;
	}

	public void setParticipatId(String participatId) {
		this.participatId = participatId;
	}

	@Column(name="create_time")
	public Integer getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Integer createTime) {
		this.createTime = createTime;
	}

	@Column(name="update_time")
	public Integer getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Integer updateTime) {
		this.updateTime = updateTime;
	}

	@Column(name="remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}



}
